<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>档案管理</title>
<!--[if lt IE 9]>
  <script src="libs/html5shiv.min.js"></script>
  <script src="libs/respond.min.js"></script>
  <![endif]-->
<script src="libs/jquery-1.12.1.min.js"></script>
<link href="libs/bootstrap-3.3.6/css/bootstrap.min.css" rel="stylesheet">
<script src="libs/bootstrap-3.3.6/js/bootstrap.min.js"></script>
<script src="libs/handlebars.min.js"></script>
<script src="libs/jquery.backstretch.min.js"></script>
<script src="libs/getQueryString.js"></script>
</head>
<body>
	<div class="container">
		<div class="row">
			<div class="page-header">
				<h2>
					<strong>档案管理</strong>
				</h2>
			</div>
		</div>
	</div>
	<div class="container">
		<div class="col-md-8">
			<ul class="nav nav-pills">
				<li class="active"><a href="#">首页</a></li>
				<li><a href="#">用户：<span id="nickname"></span></a></li>
				<button id="tuichu">用户退出</button>
			</ul>
		</div>
	</div>
	<div class="container">
		<div class="panel panel-success">
			<p>
				<img id="pic" src="" width="200" height="200" />
			</p>
			<div class="panel-body">
				<div class="col-ma-2">
					<button id="delete" class="btn btn-default btn-block">删除</button>
				</div>
			</div>
		</div>
	</div>
</body>
<script type="text/javascript">
	$(function() {
		$.getJSON('queryUsers.action', function(res) {
			$('#nickname').text(res.nickname);
		})

		$('#tuichu').click(function() {
			$.post('tuichu.action', function(res, status) {
				if ('OK' == res) {
					alert('退出成功');
					window.location.href = 'login.html'
				}
			});
		});
		$.backstretch("image/2.jpg");
		var id = getQueryString('id');
		$.getJSON('querydel.action?id=' + id, function(res) {
			$('#pic').attr('src',
					'upload/' + res[0].archive_id + '/' + res[0].name)
		})

		$('#delete').click(function() {
			$.post('deletephoto.action', {
				id : id
			}), function(res, status) {
				console.log(res);
				console.log(status);
				if ('OK' == res) {
					alert('删除成功');
					window.location.href = 'index.html';
				}
			}
		})
	})
</script>
</html>